<?php

namespace App\Cms\Controller;

class Index extends Base {

    public function index() {

        $columns_hots = [];
        
        $columns = Cms()->Column()->getArray(1)['children'];
        foreach ($columns as $column) {
            $hots = Cms()->Article()->getHotsByColumnId($column['id'], 0, 5);
            if ($hots) {
                $columns_hots[$column['id']] = $hots;
            }
        }
        
        $this->columns_hots = $columns_hots; // 各栏目推荐
        
        $this->banners = Cms()->Banner()->getCacheList(); // 轮播图
        
        $this->hotwords = Cms()->Hotword()->getCacheList(); // 搜索热词
        
        $this->tags = Cms()->Tag()->getCacheList(); // 标签

        $this->events = Cms()->Event()->getCacheList(10); // 公告

        $this->newests = Cms()->Article()->getList(0, 5, null, 'id desc'); // 最新

        $this->links = Cms()->Link()->getCacheList(); // 友情链接

        $this->friends = Cms()->Friend()->getCacheList(); // 合作伙伴
    }

}
